/*
 * @(#)MaintFormPageForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.form.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.form.bean.FormPage;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;

/**
  MaintFormPageForm.java

  This class is the for web form purpose.

  @author      Scott Tong
  @company     DCIVision Limited
  @creation date   23/12/2003
  @version     $Revision: 1.7 $
*/

public class MaintFormPageForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.7 $";

  private String formRecordID = null;
  private String parentPageID = null;
  private String title = null;
  private String titleAlt = null;
  private String pageNo = null;
  private String pageCode = null;
  private String description = null;
  private String descriptionAlt = null;
  private String titleFontColor = null;
  private String titleFontSize = null;
  private String titleFontType = null;
  private String titleFontStyle = null;
  private String descFontColor = null;
  private String descFontSize = null;
  private String descFontType = null;
  private String descFontStyle = null;
  private String titlePosition = null;
  private String groupID = null;

  private String tempDate = null;
  private String status = GlobalConstant.RECORD_PENDING;
  public static final String NAV_MODE_EXPORT = "EX";
  public static final String NAV_MODE_EXPORT_DB = "EXD"; 
  
  public MaintFormPageForm() {
    super();
  }

  public String gettitlePosition() {
    return(this.titlePosition);
  }

  public void settitlePosition(String titlePosition) {
    this.titlePosition= titlePosition;
  }


  public String getFormRecordID() {
    return(this.formRecordID);
  }

  public void setFormRecordID(String formRecordID) {
    this.formRecordID = formRecordID;
  }

  public String getParentPageID() {
    return(this.parentPageID);
  }

  public void setParentPageID(String parentPageID) {
    this.parentPageID = parentPageID;
  }

  public String getTitle() {
    return(this.title);
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getTitleAlt() {
    return(this.titleAlt);
  }

  public void setTitleAlt(String titleAlt) {
    this.titleAlt = titleAlt;
  }

  public String getPageNo() {
    return(this.pageNo);
  }

  public void setPageNo(String pageNo) {
    this.pageNo = pageNo;
  }

  public String getPageCode() {
    return(this.pageCode);
  }

  public void setPageCode(String pageCode) {
    this.pageCode = pageCode;
  }

  public String getDescription() {
    return(this.description);
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getDescriptionAlt() {
    return(this.descriptionAlt);
  }

  public void setDescriptionAlt(String descriptionAlt) {
    this.descriptionAlt = descriptionAlt;
  }

  public String getTitleFontColor() {
    return(this.titleFontColor);
  }

  public void setTitleFontColor(String titleFontColor) {
    this.titleFontColor = titleFontColor;
  }

  public String getTitleFontSize() {
    return(this.titleFontSize);
  }

  public void setTitleFontSize(String titleFontSize) {
    this.titleFontSize = titleFontSize;
  }

  public String getTitleFontType() {
    return(this.titleFontType);
  }

  public void setTitleFontType(String titleFontType) {
    this.titleFontType = titleFontType;
  }

  public String getTitleFontStyle() {
    return(this.titleFontStyle);
  }

  public void setTitleFontStyle(String titleFontStyle) {
    this.titleFontStyle = titleFontStyle;
  }

  public String getDescFontColor() {
    return(this.descFontColor);
  }

  public void setDescFontColor(String descFontColor) {
    this.descFontColor = descFontColor;
  }

  public String getDescFontSize() {
    return(this.descFontSize);
  }

  public void setDescFontSize(String descFontSize) {
    this.descFontSize = descFontSize;
  }

  public String getDescFontType() {
    return(this.descFontType);
  }

  public void setDescFontType(String descFontType) {
    this.descFontType = descFontType;
  }

  public String getDescFontStyle() {
    return(this.descFontStyle);
  }

  public void setDescFontStyle(String descFontStyle) {
    this.descFontStyle = descFontStyle;
  }

  public String getGroupID() {
    return(this.groupID);
  }

  public void setGroupID(String groupID) {
    this.groupID = groupID;
  }

  public String getTempDate() {
    return(this.tempDate);
  }

  public void setTempDate(String tempDate) {
    this.tempDate = tempDate;
  }
  
  public String getStatus() {
    return(this.status);
  }

  public void setStatus(String status) {
    this.status = status;
  }


  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setFormRecordID(null);
    this.setParentPageID(null);
    this.setTitle(null);
    this.setTitleAlt(null);
    this.setPageNo(null);
    this.setPageCode(null);
    this.setDescription(null);
    this.setDescriptionAlt(null);
    this.setTitleFontColor(null);
    this.setTitleFontSize(null);
    this.setTitleFontType(null);
    this.setTitleFontStyle(null);
    this.setDescFontColor(null);
    this.setDescFontSize(null);
    this.setDescFontType(null);
    this.setDescFontStyle(null);
    this.setGroupID(null);
    this.setTempDate(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    FormPage tmpFormPage = new FormPage();
    tmpFormPage.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpFormPage.setFormRecordID(TextUtility.parseIntegerObj(this.getFormRecordID()));
    tmpFormPage.setParentPageID(TextUtility.parseIntegerObj(this.getParentPageID()));
    tmpFormPage.setTitle(this.getTitle());
    tmpFormPage.setTitleAlt(this.getTitleAlt());
    tmpFormPage.settitlePosition(this.gettitlePosition());
    tmpFormPage.setPageNo(TextUtility.parseIntegerObj(this.getPageNo()));
    tmpFormPage.setPageCode(this.getPageCode());
    tmpFormPage.setDescription(this.getDescription());
    tmpFormPage.setDescriptionAlt(this.getDescriptionAlt());
    tmpFormPage.setTitleFontColor(this.getTitleFontColor());
    tmpFormPage.setTitleFontSize(TextUtility.parseIntegerObj(this.getTitleFontSize()));
    tmpFormPage.setTitleFontType(this.getTitleFontType());
    tmpFormPage.setTitleFontStyle(this.getTitleFontStyle());
    tmpFormPage.setDescFontColor(this.getDescFontColor());
    tmpFormPage.setDescFontSize(TextUtility.parseIntegerObj(this.getDescFontSize()));
    tmpFormPage.setDescFontType(this.getDescFontType());
    tmpFormPage.setDescFontStyle(this.getDescFontStyle());
    tmpFormPage.setGroupID(TextUtility.parseIntegerObj(this.getGroupID()));
    tmpFormPage.setRecordStatus(this.getRecordStatus());
    tmpFormPage.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpFormPage.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpFormPage.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpFormPage.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpFormPage.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpFormPage;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    FormPage tmpFormPage = (FormPage)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpFormPage.getID()));
    this.setFormRecordID(TextUtility.formatIntegerObj(tmpFormPage.getFormRecordID()));
    this.setParentPageID(TextUtility.formatIntegerObj(tmpFormPage.getParentPageID()));
    this.setTitle(tmpFormPage.getTitle());
    this.setTitleAlt(tmpFormPage.getTitleAlt());
    this.setPageNo(TextUtility.formatIntegerObj(tmpFormPage.getPageNo()));
    this.setPageCode(tmpFormPage.getPageCode());
    this.settitlePosition(tmpFormPage.gettitlePosition());
    this.setDescription(tmpFormPage.getDescription());
    this.setDescriptionAlt(tmpFormPage.getDescriptionAlt());
    this.setTitleFontColor(tmpFormPage.getTitleFontColor());
    this.setTitleFontSize(TextUtility.formatIntegerObj(tmpFormPage.getTitleFontSize()));
    this.setTitleFontType(tmpFormPage.getTitleFontType());
    this.setTitleFontStyle(tmpFormPage.getTitleFontStyle());
    this.setDescFontColor(tmpFormPage.getDescFontColor());
    this.setDescFontSize(TextUtility.formatIntegerObj(tmpFormPage.getDescFontSize()));
    this.setDescFontType(tmpFormPage.getDescFontType());
    this.setDescFontStyle(tmpFormPage.getDescFontStyle());
    this.setGroupID(TextUtility.formatIntegerObj(tmpFormPage.getGroupID()));
    this.setRecordStatus(tmpFormPage.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpFormPage.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpFormPage.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpFormPage.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpFormPage.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpFormPage.getUpdateDate()));
  }
}
